home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_psutils.idb / usr / freeware / bin / fixwfwps.z / fixwfwps
Encoding:
Text File  |  1999-07-16  |  866 b   |  37 lines

  1. #!/usr/freeware/bin/perl
  2. eval 'exec perl -S $0 "$@"'
  3.     if $running_under_some_shell;
  4.  
  5. # fixwfwps: fix Word for windows PostScript for printing.
  6. #
  7. # Copyright (C) Angus J. C. Duggan 1991-1995
  8. # See file LICENSE for details.
  9.  
  10. $nesting = 0;
  11. while (<>) {
  12.    tr/\000-\010\012-\014\016-\037//d;
  13.    foreach (grep($_ ne "", split("\015"))) {
  14.       s!/SVDoc\s+save\s+def!!g;
  15.       s!SVDoc\s+restore!!g;
  16.       if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) {
  17.      print "$1\n";
  18.      $wfwepsf = 1;
  19.       } elsif (/^SS\s*$/ && $wfwepsf) {
  20.      print "%%Page: $wfwepsf $wfwepsf\n";
  21.      $wfwepsf++;
  22.      print "$_\n";
  23.       } elsif (/^%MSEPS Preamble/) {
  24.      print "%%BeginDocument: (Included EPSF)\n";
  25.      print "$_\n";
  26.      $nesting++;
  27.       } elsif (/^%MSEPS Trailer/) {
  28.      $nesting--;
  29.      print "$_\n";
  30.      print "%%EndDocument\n";
  31.       } elsif (! /^%%BoundingBox/) {
  32.      print "$_\n";
  33.       }
  34.    }
  35. }
  36.  
  37.